home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / utility / horst_2.zip / LISTMOD.XAM < prev    next >
Text File  |  1995-12-18  |  4KB  |  149 lines

  1.  
  2. LISTMOD works well with other batch utilities.  Here are some examples to 
  3. help people new to redirection, pipes, and batch files.
  4.  
  5. ---------------------------------------------------------------------------
  6.  
  7. EXAMPLE (1)
  8.  
  9. I want to back up all configuration files onto a floppy disk, but without 
  10. overwriting any that are on the floppy already.  PC Magazine's WHEREIS can 
  11. find them and LISTMOD does the rest; 
  12.  
  13. whereis *.cfg | listmod if not exist a:$1 copy $1 a: $) nul > bak_cfg.bat
  14.  
  15. gives a bak_cfg.bat like 
  16.  
  17. if not exist a:\STD_DOS.CFG copy \STD_DOS.CFG a: > nul
  18. if not exist a:\STSCFG.CFG copy \STSCFG.CFG a: > nul
  19. if not exist a:\BWAVE\BWAVE200.CFG copy \BWAVE\BWAVE200.CFG a: > nul
  20. :::
  21.  
  22. 1) a:$1 not a:\$1, because WHEREIS puts in the leading backslash itself.  
  23.  
  24. 2) $) hides the redirection character >, to make "> nul" so the batch 
  25.    file runs quietly. It would otherwise be read by DOS as a redirection 
  26.    while LISTMOD was working and get confused by anything else on the line 
  27.    after it.  
  28.  
  29. ---------------------------------------------------------------------------
  30.  
  31. EXAMPLE (2)
  32.  
  33. Norton 4.5 does not move hidden files when defragmenting the hard disk.  I 
  34. want to unhide them with ATTRIB -H, defragment, then hide them again.  
  35. Keith Graham's well-known file finder FF.COM can find hidden files easily, 
  36. but finds system files as well, e.g., 
  37.  
  38. FF *.* /S gives 
  39.  
  40. C:\IBMBIO.COM
  41. C:\IBMDOS.COM
  42. C:\IMAGE.IDX
  43. C:\TBAVINFO.KEY
  44. C:\DOS\ARC\ARCPARK\DESCRIPT.ION
  45. :::
  46.  
  47. *BIG* oops... found IBMBIO.COM and IBMDOS.COM as well, and if we move 
  48. _those_, the disk won't boot!  Enter the Free Software Foundation's Stream 
  49. EDitor, SED;
  50.  
  51. FF *.* /S | SED -F FFJUNK.SED | LISTMOD ATTRIB %%1 $1 > CHANGE.BAT
  52.  
  53. remember the _two_ % signs because we're at a command line, and where the 
  54. SED script FFJUNK.SED is 
  55.  
  56. /fast file finder/d
  57. /Keith P. Graham/d
  58. /Total elapsed time:/d
  59. /For the latest release/d
  60. /call PC Rockland/d
  61. /IBMBIO.COM/d
  62. /IBMDOS.COM/d
  63.  
  64. The command now gives a CHANGE.BAT like 
  65.  
  66. attrib %1 C:\IMAGE.IDX
  67. attrib %1 C:\TBAVINFO.KEY
  68. attrib %1 C:\DOS\ARC\ARCPARK\DESCRIPT.ION
  69. :::
  70.  
  71. this can now be called by CHANGE -H to remove the hidden attributes of the 
  72. non-dangerous files; and called again with CHANGE +H to put them back again 
  73. after defragmenting the disk.
  74.  
  75. ---------------------------------------------------------------------------
  76.  
  77. EXAMPLE (3)
  78.  
  79. You have a load of files belonging to one project series, and decide to 
  80. give them sequential names, oldest file with lowest number.  
  81.  
  82. DIR /O:D /B *.TXT | LISTMOD REN $1 $#.TXT $) NUL > NUMBER.BAT
  83.  
  84. The switches after DIR; /O:D, sort by date, oldest first; /B, give a "bare 
  85. bones" listing without parent and subdirectories or summaries.
  86.  
  87. This generates a NUMBER.BAT like;
  88.  
  89. ren clockon.txt 001.txt > nul
  90. ren enter.txt 002.txt > nul
  91. ren bt_codes.txt 003.txt > nul
  92. :::
  93.  
  94.  
  95. To start with, DIR /O:D gives; 
  96.  
  97.  Volume in drive C is MS-DOS_5       Serial number is 1A98:B039
  98.  Directory of  c:\junk\test\*.*
  99.  
  100. clockon.txt      2279  27/11/90   8:41 
  101. enter.txt           2   4/04/93   3:21 
  102. bt_codes.txt     8953   8/11/93  13:39 
  103. dbugetc.txt     16111   2/03/94  22:52 
  104. xeq160.txt      23820  12/03/94  22:08 
  105. clearbuf.txt     3991  13/03/94  22:08 
  106. .            <DIR>      2/04/94  21:25 
  107. ..           <DIR>      2/04/94  21:25 
  108. modem.txt       22459  15/05/94  20:47 
  109. stepper.txt      4481  18/05/94   0:00 
  110. :::
  111.  
  112.  
  113. DIR /O:D /B gives; 
  114.  
  115. clockon.txt 
  116. enter.txt   
  117. bt_codes.txt
  118. dbugetc.txt 
  119. xeq160.txt  
  120. clearbuf.txt
  121. modem.txt   
  122. stepper.txt 
  123.  
  124. After running the LISTMOD command line to make NUMBER.BAT, then running 
  125. NUMBER.BAT itself, and doing DIR /O:D again, gives; 
  126.  
  127.  Volume in drive C is MS-DOS_5       Serial number is 1A98:B039
  128.  Directory of  c:\junk\test\*.*
  129.  
  130. 001.txt          2279  27/11/90   8:41 
  131. 002.txt             2   4/04/93   3:21 
  132. 003.txt          8953   8/11/93  13:39 
  133. 004.txt         16111   2/03/94  22:52 
  134. 005.txt         23820  12/03/94  22:08 
  135. 006.txt          3991  13/03/94  22:08 
  136. .            <DIR>      2/04/94  21:25 
  137. ..           <DIR>      2/04/94  21:25 
  138. 007.txt         22459  15/05/94  20:47 
  139. 008.txt          4481  18/05/94   0:00 
  140.  
  141. Renaming the files as intended.
  142.  
  143.  
  144. ---------------------------------------------------------------------------
  145.  
  146. *** these examples by Robert Bull, 30.09.194
  147.  
  148. <EOF>
  149.